﻿<%@ Page Title="Cocina" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
 CodeBehind="cocina.aspx.cs" Inherits="Restaurante.cocina"%>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
         <p id="titulo"> Cocina </p>
    </h2>
<div id="usuleft" Class="contTabla" style="width: 350px;
    float: left;">  
    <table>
        <tr>
            <td>
                <asp:Label ID="Label3" runat="server" Text="Plato:"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtDetalle" runat="server" Visible="False"></asp:TextBox>
                <asp:TextBox ID="txbPlato" runat="server" Enabled="False"></asp:TextBox>
            </td> 
        </tr>
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="Estado:"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlEstado" runat="server" DataSourceID="EstadosCocina" 
                    DataTextField="Descripcion" DataValueField="Id_Estado">
                </asp:DropDownList>
                <asp:SqlDataSource ID="EstadosCocina" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BarCafe %>" 
                    ProviderName="<%$ ConnectionStrings:BarCafe.ProviderName %>" SelectCommand="select Id_Estado, Descripcion 
                                    from estado
                                    where Clave = 'Cocina'
                                    union all 
                                    select 0, 'Sin Seleccionar'
                                    order by 1
                                    ">
               </asp:SqlDataSource>
            </td> 
        </tr>
    </table>
     <asp:Button ID="btnAgregar" runat="server" Text="Aceptar" 
        onclick="btnAgregar_Click" />
   
    <asp:Button ID="btnCancelar" runat="server" Text="Cancelar" 
        onclick="btnCancelar_Click" />
</div>

     <div class="contTabla">
         <asp:GridView ID="gvCocina" runat="server" AllowPaging="True" 
             AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
             DataSourceID="CocinaGrilla" ForeColor="#333333" GridLines="None" 
             onselectedindexchanged="gvCocina_SelectedIndexChanged" 
             DataKeyNames="detalle">
             <AlternatingRowStyle BackColor="White" />
             <Columns>
                 <asp:CommandField ShowSelectButton="True" />
                 <asp:BoundField DataField="comanda" HeaderText="comanda" 
                    SortExpression="comanda" />                                 
                 <asp:BoundField DataField="plato" HeaderText="plato" ReadOnly="False" 
                     SortExpression="plato" />
                 <asp:BoundField DataField="platos" HeaderText="platos" 
                     SortExpression="platos" />
                 <asp:BoundField DataField="platos" HeaderText="platos" 
                     SortExpression="platos" ReadOnly="True" />
                 <asp:BoundField DataField="menu" HeaderText="menu" 
                     SortExpression="menu" />
                 <asp:BoundField DataField="menues" HeaderText="menues" 
                     SortExpression="menues" />
                 <asp:BoundField DataField="estado" HeaderText="estado" 
                     SortExpression="estado" />
                <asp:BoundField DataField="detalle" HeaderText="detalle"  
                    ReadOnly="True" SortExpression="detalle" Visible="True" />
             </Columns>
             <EditRowStyle BackColor="#2461BF" />
             <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
             <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
             <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
             <RowStyle BackColor="#EFF3FB" />
             <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
             <SortedAscendingCellStyle BackColor="#F5F7FB" />
             <SortedAscendingHeaderStyle BackColor="#6D95E1" />
             <SortedDescendingCellStyle BackColor="#E9EBEF" />
             <SortedDescendingHeaderStyle BackColor="#4870BE" />
         </asp:GridView>
         <asp:SqlDataSource ID="CocinaGrilla" runat="server" 
             ConnectionString="<%$ ConnectionStrings:BarCafe %>" 
             ProviderName="<%$ ConnectionStrings:BarCafe.ProviderName %>" SelectCommand=" SELECT c.Nro_Comanda comanda,  
                 c.id_detalle detalle,          
		(select m.Descripcion 
			from menues m
			where c.Menues_Id_Menu = m.Id_Menu
			)plato,
			c.Cantidad_Menu platos,
			(select mp.Descripcion 
			from Menu_Precargado mp
			where c.Menu_Precargado_Id_MenuPrecargado = mp.Id_MenuPrecargado
			)menu,
			c.Cantidad_Menu_Precargado menues,
			e.Descripcion estado
	FROM Comanda_Detalle c,       
		Estado e,
		Usuario u
where e.Id_Estado = c.Id_Estado
	and u.Id_Usuario = c.Id_Usruario
                   and e.id_estado =1">
        </asp:SqlDataSource>
     </div>
   
     <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
</asp:Content>